<template>
	<div>
		<div class="ques-opt-title">
			<i v-if="question?.attribute?.required" class="star"></i>
			{{ index + 1 }}、 {{ question.title }}
			<sub v-if="question?.score">{{ question.score }} 分</sub>
			<i v-if="!isValid" class="required-err-msg">必填</i>
		</div>
		<div class="ques-opt-body">
			<label v-for="option in question.children" class="checkbox">
				<input type="checkbox" :value="option.id" v-model="question.answer" :disabled="disabled" />
				<span>
					{{ option.title }}
					<span v-if="scoreIs" class="score">（ {{ option?.attribute?.score }} ） 分</span>
				</span>
			</label>
		</div>
	</div>
</template>

<script>
import ques from "./quesComponents.js";
export default {
	mixins: [ques],
	methods: {
		//校验是否完成，与isValid的区别就是，不用校验必填项，如果填写了，那么返回true，否则返回false
		isFinished() {
			return this.question.answer && this.question.answer.length > 0;
		}
	}
};
</script>
